<%-- 
    Document   : temp
    Created on : Oct 11, 2013, 10:09:53 AM
    Author     : NGUYEN
--%>

<%@page import="DAO.KHACHHANGDAO"%>
<%@page import="DTO.KHACHHANGDTO"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DanhSachKhachHang</title>
<script language="javascript" type="text/javascript">
	function showMenu(isShow,idSubMenu)
	{
		var subMenu = document.getElementById(idSubMenu);
		if(isShow==true)
			subMenu.style.visibility = "visible"
		else
			subMenu.style.visibility = "hidden"
	}
</script>
<style type="text/css">
	.menu
	{
		position:absolute;
		visibility:hidden;
	}
	
	
</style>
</head>


<body>
<table width="800" border="1" align="center">
<!--header-->
<jsp:include page="header.jsp"/>
  <!--header end-->
  
  <!--menu-->
  <jsp:include page="menu.jsp"/>
    <!--menu end-->
    
    <!--body-->
    <tr>
  	
    <td height="404" align="center" valign="top"><p><b>DANH SÁCH KHÁCH HÀNG  </b></p>
      <form id="form1" name="form1" method="post" action="timkiemkhachhang">
        <label>
          <input name="btTimSP" type="submit" id="btTimSP" value="Tìm Kiếm" />
        </label>
        <p>
          <label>
          <select name="select">
              <option value="1">Tìm Theo Mã</option>
              <option value="2">Tìm Theo Tên</option>
          </select>
          </label>
          <label>
          <input name="tfTimSP" type="text" id="tfTimSP" />
          </label>
        </p>
      </form>      
      <table width="80%" border="1" align="center">
        <tr>
          <td width="10%" align="center" bgcolor="#99CC00">Mã KH </td>
          <td width="25%" align="center" bgcolor="#99CC00">Tên Khách Hàng </td>
          <td width="25%" align="center" bgcolor="#99CC00">Địa chỉ </td>
          <td width="20%" align="center" bgcolor="#99CC00">Phone </td>
          
        </tr>
          
          <!--Bat dau vong lap for(i=0;i<so dong;i++):de cho ra so dong cua Table-->
          <%
                            
                            ArrayList<KHACHHANGDTO> ds = new ArrayList<KHACHHANGDTO>();
                         
                            ds = (ArrayList<KHACHHANGDTO>)request.getAttribute("danhsach");
                         
                            if (ds.isEmpty()) {
                        %>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <%                } else {
                            for (int i = 0; i < ds.size(); i++) {
                                int makh = ds.get(i).getMakh();
                                String tenkh = ds.get(i).getTenkh();
                                String diachi = ds.get(i).getDiachi();
                                String phone = ds.get(i).getPhone();
                        %>
        </tr>
        <tr>
            <td><a href="laykhachhangcoma?ma=<%=makh%>"><%=makh%></td>
            <td><%=tenkh%></td>
            <td><%=diachi%></td>
            <td><%=phone%></td>
          
        </tr>
           <%
                                }

                            }
                        %>
          <!--Ket thuc vong lap for()-->
          
          
        
      </table>      
      <form id="form3" name="form3" method="post" action="themkhachhang.jsp">
        <label>
          <input name="btThemSP" type="submit" id="btThemSP" value="Thêm" style="width:70px"/>
        </label>
      </form>      <p>&nbsp; </p></td>
	  </tr>
  <!--body end-->
  <!--footer-->
  <jsp:include page="footer.jsp"/>
  <!--footer end-->
</table>
</body>
</html>


